package test;

/**
 * @Description :
 * @FileName: StringUtil.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年10月30日 上午9:19:12
 * @Version:V1.00
 */
public class StringUtil {

	public static String remove(final String str, final String remove) {
		if (isEmpty(str) || isEmpty(remove)) {
			return str;
		}

		int start = 0;
		int end = str.indexOf(remove, start);

		if (end == -1) {
			return str;
		}

		final StringBuilder buf = new StringBuilder(str.length());
		final int removeLen = remove.length();
		while (end != -1) {
			buf.append(str.substring(start, end));
			start = end + removeLen;
			end = str.indexOf(remove, start);
		}
		buf.append(str.substring(start));
		return buf.toString();
	}

	public static final boolean isEmpty(final CharSequence cs) {
		return cs == null || cs.length() == 0;
	}

}
